// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.randomizedWorld.randomizedDeadSurvivor;

import java.util.ArrayList;
import zombie.characters.IsoZombie;
import zombie.core.Rand;
import zombie.iso.BuildingDef;
import zombie.iso.IsoGridSquare;
import zombie.iso.RoomDef;
import zombie.vehicles.BaseVehicle;

public final class RDSPoliceAtHouse extends RandomizedDeadSurvivorBase {
    public RDSPoliceAtHouse() {
        this.name = "Police at House";
        this.setChance(4);
    }

    @Override
    public void randomizeDeadSurvivor(BuildingDef def) {
        RoomDef roomDef = this.getLivingRoomOrKitchen(def);
        this.addZombies(def, Rand.Next(2, 4), null, Integer.valueOf(0), roomDef);
        ArrayList arrayList0 = this.addZombies(def, Rand.Next(1, 3), "Police", null, roomDef);
        BaseVehicle baseVehicle = this.spawnCarOnNearestNav("Base.CarLightsPolice", def);
        if (baseVehicle != null) {
            IsoGridSquare isoGridSquare = baseVehicle.getSquare().getCell().getGridSquare(baseVehicle.getSquare().x - 2, baseVehicle.getSquare().y - 2, 0);
            ArrayList arrayList1 = this.addZombiesOnSquare(2, "Police", null, isoGridSquare);
            createRandomDeadBody(roomDef, Rand.Next(7, 10));
            createRandomDeadBody(roomDef, Rand.Next(7, 10));
            if (!arrayList0.isEmpty()) {
                arrayList0.addAll(arrayList1);
                ((IsoZombie)arrayList0.get(Rand.Next(arrayList0.size()))).addItemToSpawnAtDeath(baseVehicle.createVehicleKey());
                def.bAlarmed = false;
            }
        }
    }
}
